<?php

    //
    $vid = $_GET['vid'];
    $bstrURL = "https://u.y.qq.com/cgi-bin/musicu.fcg";
    $postData = '{"comm":{"ct":6,"cv":0,"g_tk":5381,"uin":0,"format":"json","platform":"yqq"},"mvInfo":{"module":"video.VideoDataServer","method":"get_video_info_batch","param":{"vidlist":["'.$vid.'"],"required":["vid","type","sid","cover_pic","duration","singers","new_switch_str","video_pay","hint","code","msg","name","desc","playcnt","pubdate","isfav","fileid","filesize","pay","pay_info","uploader_headurl","uploader_nick","uploader_uin","uploader_encuin"]}},"mvUrl":{"module":"music.stream.MvUrlProxy","method":"GetMvUrls","param":{"vids":["'.$vid.'"],"request_type":10003,"addrtype":3,"format":264}}}';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $bstrURL);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, ($postData));
    $data = curl_exec($ch);
    curl_close($ch);
    $json = json_decode($data);
    $aryPlayList = [];
    foreach($json->mvUrl->data->$vid->mp4 as $lst)
    {
        $playUrl = $lst->freeflow_url[0];
        if($playUrl != '')
        {
            $aryPlayList[] = $playUrl;
        }
    }

    header("location:".end($aryPlayList));

?>